from csagent.core.node.base_node import BaseNode
from csagent.core.context import AgentState
import time
class Node(BaseNode):
    def initialize(self):
        """初始化节点"""
        print(self.conf)
        print('food recommend Node初始化成功')
    def execute(self, state: AgentState, stream_writer=None) -> AgentState:
        print(f"[食品推荐]food recommend node开始执行")
        query = state['messages'][-1]['content']
        print(f"[食品推荐]query:{query}")
        print(f"[食品推荐]用户画像:{state['node_context']['user_feature']}")
        print("[食品推荐]食物推荐中......")
        time.sleep(1)
        state['node_context']['food_recommend'] = "宫保鸡丁"
        print(f"[食品推荐]food recommend node执行完成")
        return state